// -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -

float4x4 obj2projection;
float4x4 obj2world;
float4x4 world2obj;

float3 eyePosition;

// -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -

float4 materialAmbient = float4 (0.1, 0.1, 0.1, 1.0);
float4 materialDiffuse = float4 (0.8, 0.8, 0.8, 1.0);
float4 materialSpecular = float4 (0.9, 0.9, 0.9, 1.0);

float4 lightAmbient = float4 (0.2, 0.2, 0.2, 1.0);
float4 lightDiffuse = float4 (0.9, 0.9, 0.9, 1.0);
float4 lightSpecular = float4 (0.9, 0.9, 0.9, 1.0);
float3 lightPosition;

float considerAlpha = 0.0;

// -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -

texture diffuseTexture;

sampler diffuseTextureSampler = sampler_state
{
	texture = <diffuseTexture>;
	AddressU = WRAP;
	AddressV = WRAP;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = POINT;
};

// -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -

struct VShaderInput
{
float4 position : POSITION;
float3 normal   : NORMAL;
float3 binormal : BINORMAL;
float3 tangent  : TANGENT;
float2 tex0     : TEXCOORD0;
};

struct PShaderInput
{
float4 hpos : POSITION;
float4 col0 : COLOR0;
float4 col1 : COLOR1;
float2 tex0 : TEXCOORD0;
float3 L    : TEXCOORD1;
float3 V    : TEXCOORD2;
float3 N    : TEXCOORD3;
float3 TBN0 : TEXCOORD4;
float3 TBN1 : TEXCOORD5;
float3 TBN2 : TEXCOORD6;
};

// -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -

PShaderInput vs_unlit( VShaderInput input )
{
	PShaderInput result = (PShaderInput)0;
	result.hpos = mul( input.position, obj2projection );
	result.tex0 = input.tex0;

	return result;
}

float4 ps_unlit( PShaderInput input ) : COLOR0
{
	float4 output = tex2D ( diffuseTextureSampler, input.tex0 );
	output.a = output.a * considerAlpha + 1 * (1.0-considerAlpha);
	return output;
}

technique Unlit
{
	pass P0
	{
		AlphaBlendEnable = TRUE;
        DestBlend = INVSRCALPHA;
        SrcBlend = SRCALPHA;
		vertexShader = compile vs_2_0 vs_unlit();
		pixelShader = compile ps_2_0 ps_unlit();
	}
}

// -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- -
